package com.vma.jifu.controller;

import com.vma.jifu.advertisement.service.AdvertisementService;
import com.vma.jifu.advertisement.service.impl.AdvertisementServiceImpl;
import com.vma.jifu.bizModel.model.*;
import com.vma.jifu.offer.service.OfferService;
import com.vma.jifu.offer.service.impl.OfferServiceImpl;
import com.vma.jifu.others.CustLinkService;
import com.vma.jifu.others.IndexImgService;
import com.vma.jifu.others.impl.CustLinkServiceImpl;
import com.vma.jifu.others.impl.IndexImgServiceImpl;
import com.vma.jifu.service.AgentService;
import com.vma.jifu.service.impl.AgentServiceImpl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by chenzui on 2017/6/22.
 */
public class IndexController extends BaseController {


    private AdvertisementService advertisementService = new AdvertisementServiceImpl();

    private OfferService offerService = new OfferServiceImpl();

    private IndexImgService indexImgService = new IndexImgServiceImpl();

    private CustLinkService linkService = new CustLinkServiceImpl();

    private AgentService agentService = new AgentServiceImpl();

    public void index(){
        //查询首页banners
        List<Advertisement> ads = advertisementService.qryAdList();
        //查询热销商品
        List<Offer> hotOffers = offerService.qryHotOffers();
        //查询首页图片
        IndexImg img = indexImgService.getIndexImg();

        List<CustQq> custQqs = linkService.qryQQList();

        CustPhone phone = linkService.getPhone();

        Map result = new HashMap();

        result.put("ads",ads);
        result.put("hotOffers",hotOffers);
        result.put("img",img);
        result.put("phone",phone);
        result.put("custQqs",custQqs);

        renderRes(result);
    }

    public void initJoinFee(){
        agentService.initJoinFee();
        renderRes("success");
    }
}
